<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<TITLE>FileHelpers Library - Marcos Meli</TITLE>
		<LINK href="/favicon.ico" rel="SHORTCUT ICON">
<link type="text/css" rel="stylesheet" href="SyntaxHighlighter.css"></link>

			<LINK href="global.css" type="text/css" rel="stylesheet">
				<meta NAME="Description" content="FileHelpers are an easy to use .NET library to read/write data from fixed length or delimited files or streams. It has support to import/export data from different data sources.">
				<meta name="Author" content="Marcos Meli">
<meta NAME="keywords" Content="filehelpers,CSV,Marcos_Meli,C#,free,opensource,Devoo.net,Delimited Files,Import/Export">
				<meta NAME="Copyright" CONTENT="Copyright 2005-07 to Marcos Meli - www.Devoo.net. All Rights Reserved.">
	</HEAD>
	<BODY text="black" vLink="purple" aLink="red" link="blue" bgColor="white" leftMargin="0"
		topMargin="0">

		{$HEADER$}


		<table width="100%" cellpadding="5" cellspacing="5">
			<tr>
				<td><div id="contentdiv">
						<h2>Excel DataLink Example
						</h2>
						<blockquote>
							<p>This example shows how to extract and insert records&nbsp;from/to a Microsoft 
								Excel Worksheet.
							</p>
						</blockquote>
						<h2>
							Introduction
						</h2>
						<blockquote>
							<p>If You want to transfer data from this Excel to a File or other Data Storage you 
								must follow this steps:
							</p>
							<p>For example with the&nbsp;following worksheet (from the Northwind DB)</p>
							<p><img src="excel.png" width="611" height="414"></p>
							<p>&nbsp;</p>
						</blockquote>
						<h2>
							To use Delimited Format</h2>
							<p>You must define:</p>
							<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
<textarea name="code" class="c#">

	[DelimitedRecord("|")]
	public class CustomersVerticalBar
	{
		public string CustomerID;

		public string CompanyName;

		public string ContactName;

		public string ContactTitle;

		public string Address;

		public string City;

		public string Country;
	}
</textarea>
							</blockquote>
						<h2>The Solution</h2>
						<p>&nbsp;&nbsp; Finally use the ExcelDataStorage to Read the records.&nbsp;</p>
						<blockquote>
<textarea name="code" class="c#">
							
   ExcelStorage provider = new ExcelStorage(typeof(CustomersVerticalBar));
   
   provider.StartRow = 3;
   provider.StartColumn = 2;
			
   provider.FileName = "Customers.xls";
   
   CustomerVerticalBar[] res = (CustomerVerticalBar[]) provider.ExtractRecords();

</textarea>

						</blockquote>
		{$FOOTER$}
				</td>
			</tr>
		</table>

	</BODY>
</HTML>
